﻿// Copyright 2009 Mike Geise
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Falcon.Core.Domain.Services
{
	using System.Collections.Generic;
	using Falcon.Core.Collections;
	using Falcon.Core.Domain.Values;

	public interface IUserService
	{
		/// <summary>
		/// Gets the user by the specified specification.
		/// </summary>
		/// <param name="specification">The <see cref="UserSpecification"/>.</param>
		User GetBy(UserSpecification specification);

		/// <summary>
		/// Gets the user by the specified id.
		/// </summary>
		/// <param name="id">The id.</param>
		User GetById(int id);

		/// <summary>
		/// Gets all the users by the specified specification.
		/// </summary>
		/// <param name="specification">The <see cref="UserSpecification"/>.</param>
		IList<User> GetAll(UserSpecification specification);

		/// <summary>
		/// Gets all the users by the specified specification using paging.
		/// </summary>
		/// <param name="specification">The <see cref="UserSpecification"/>.</param>
		IPagedList<User, UserSpecification> GetPaged(UserSpecification specification);

		/// <summary>
		/// Gets the user session.
		/// </summary>
		/// <param name="name">The name (identity name).</param>
		/// <returns></returns>
		UserSession GetSession(string name);

		/// <summary>
		/// Creates the user.
		/// </summary>
		User Create();

		/// <summary>
		/// Gets the users count by the specified specification.
		/// </summary>
		/// <param name="specification">The specification.</param>
		/// <returns></returns>
		int Count(UserSpecification specification);

		/// <summary>
		/// Inserts the user into the storage.
		/// </summary>
		/// <param name="user">The <see cref="User"/>.</param>
		void Insert(User user);

		/// <summary>
		/// Insert the user into the storage.
		/// </summary>
		/// <param name="user">The <see cref="User"/>.</param>
		/// <param name="value">The <see cref="UserCreate"/> value to insert the user with.</param>
		void Insert(User user, UserCreate value);

		/// <summary>
		/// Updates the user in the storage.
		/// </summary>
		/// <param name="user">The <see cref="User"/>.</param>
		void Update(User user);

		/// <summary>
		/// Updates the user in the storage.
		/// </summary>
		/// <param name="user">The <see cref="User"/>.</param>
		/// <param name="value">The <see cref="UserUpdate"/> value to update the user with.</param>
		void Update(User user, UserUpdate value);

		/// <summary>
		/// Deletes the user in the storage.
		/// </summary>
		/// <param name="user">The <see cref="User"/>.</param>
		void Delete(User user);
	}
}